Balancing usage of hardware devices among clients

ABSTRACT

Techniques are disclosed for managing the flow of IO jobs from a client to a hardware device such that resource starvation is reduced without significantly impacting throughput. Each flow can be assigned an amount of time that a hardware device can deplete completing IO jobs from the client. When the allocated amount of time is used IO jobs associated with the client can be stored in a queue until the client obtains more time.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is related to U.S. patent application Ser. No. ______(Attorney Docket No. MVIR—0208/MS-324518.01) entitled “TEMPORAL BATCHINGOF I/O JOBS” filed Sep. 30, 2008 and incorporated by reference in itsentirety; and U.S. application Ser. No. ______ (Attorney Docket No.MVIR—0207/MS-324517.01) entitled “HARDWARE THROUGHPUT SATURATIONDETECTION” filed Sep. 30, 2008 and incorporated by reference in itsentirety.

BACKGROUND

Virtualization provides techniques for consolidating physical machines.That is, multiple virtual machines can be executed by a single physicalmachine. When servers are consolidated, a problem exists in how thevirtual machines access the physical hardware. For example, if 5 virtualmachines are effectuated by software instructions each one of them mayattempt to access a physical hardware device such as a storage device,network adaptor, etc. The hardware device many not be able toefficiently support this many requestors and one or more of the virtualmachines may experience resource starvation, e.g., the instance wherethe virtual machine is denied resources and its requests experience highlatency. This is due to the fact that hardware devices are notconfigured to process information that identifies which IO jobs are fromwhich virtual machine. The hardware device of course does not select IOjobs to complete in an arbitrary order, it selects IO jobs to maximizethroughput and because of this certain IO jobs may sit in the device'sbuffer for an unacceptable length of time. For example, a driver for ahardware device such as a storage device may complete 200 IO jobs from afirst virtual machine before completing 8 IO jobs from a second virtualmachine because completing the 200 IO jobs may allow the hardware deviceto achieve higher throughput than if it completed the 8 IO jobs. Onesolution to eliminate resource starvation would be to limit the IO jobsthat the driver can select buy sending IO jobs to the hardware one at atime. This technique implemented naively would severely impactthroughput. That is, by hand picking each IO job the hardware devicewould not be able to reach its throughput potential. Thus, techniquesfor balancing throughput vs. resource starvation are desirable.

SUMMARY

An example embodiment of the present disclosure describes a method. Inthis example, the method includes, but is not limited to receiving an IOjob associated with a client; determining that a hardware device hasspent an estimated amount of time completing jobs associated with theclient that exceeds an amount of time that was allocated to complete IOjobs from the client; and storing the IO job in a queue. In addition tothe foregoing, other aspects are described in the claims, drawings, andtext forming a part of the present disclosure.

An example embodiment of the present disclosure describes a method. Inthis example, the method includes, but is not limited to storing a valueindicative of an amount of time a hardware device can spend completingIO jobs from the client; receiving IO jobs associated with the client;estimating an amount of time the hardware device will need to completethe IO jobs; and revising the value based on the estimated amount oftime required to complete the IO jobs. In addition to the foregoing,other aspects are described in the claims, drawings, and text forming apart of the present disclosure.

An example embodiment of the present disclosure describes a method. Inthis example, the method includes, but is not limited to storing aplurality of negative time values, each negative time value associatedwith a client, each negative time value being indicative of an estimatedamount of time that a hardware device spent completing IO jobsassociated with the client; storing a value indicative of an issue line,the value indicative of the issue line separating positive time valuesfrom the negative values, the positive time values associated withclients that are eligible to send IO jobs to the hardware device; andreceiving a job completion signal from the hardware device. In additionto the foregoing, other aspects are described in the claims, drawings,and text forming a part of the present disclosure.

It can be appreciated by one of skill in the art that one or morevarious aspects of the disclosure may include but are not limited tocircuitry and/or programming for effecting the herein-referenced aspectsof the present disclosure; the circuitry and/or programming can bevirtually any combination of hardware, software, and/or firmwareconfigured to effect the herein-referenced aspects depending upon thedesign choices of the system designer.

The foregoing is a summary and thus contains, by necessity,simplifications, generalizations and omissions of detail. Those skilledin the art will appreciate that the summary is illustrative only and isnot intended to be in any way limiting.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts an example computer system wherein aspects of the presentdisclosure can be implemented.

FIG. 2 depicts an operational environment for practicing aspects of thepresent disclosure.

FIG. 3 depicts an operational environment for practicing aspects of thepresent disclosure.

FIG.4 provides an example that can be used to illustrate the concept of‘flows.’

FIG. 5 illustrates an operational procedure for balancing usage of ahardware device.

FIG. 6 depicts an alternative embodiment of the operational procedure500 of FIG. 5.

FIG. 7 illustrates an alternative embodiment of the operationalprocedure 500 of FIG. 6.

FIG. 8 illustrates an alternative embodiment of the operationalprocedure 500 of FIG. 7.

FIG. 9 illustrates an operational procedure for practicing aspects ofthe present disclosure.

FIG. 10 illustrates an alternative embodiment of the operationalprocedure 900 of FIG. 9.

FIG. 11 illustrates an alternative embodiment of the operationalprocedure 900 of FIG. 10.

FIG. 12 illustrates an alternative embodiment of the operationalprocedure 900 of FIG. 11.

FIG. 13 illustrates an operational procedure for balancing IO requests.

FIG. 14 shows an alternative embodiment of the operational procedure1300 of FIG. 13.

FIG. 15 shows an alternative embodiment of the operational procedure1300 of FIG. 14.

FIG. 16 shows an alternative embodiment of the operational procedure1300 of FIG. 15.

DETAILED DESCRIPTION

Embodiments of the present disclosure may execute on one or morecomputers. FIG. 1 and the following discussion is intended to provide abrief general description of a suitable computing environment in whichthe disclosure may be implemented. One skilled in the art can appreciatethat some or all of the components of the computer system of FIG. 1 canbe used to effectuate computer 200 of FIG. 2 and the computer 200 ofFIG. 3.

The term circuitry used through the disclosure can include specializedhardware components such as hardware interrupt controllers, hard drives,network adaptors, graphics processors, and audio codecs for example. Inthe same or other embodiments circuitry can include microprocessorsconfigured to perform function(s) by firmware or by set switches. In thesame or other example embodiments circuitry can include one or morelogical processors, e.g., one or more cores of a multi-core generalprocessing unit. The logical processor(s) in this example can beconfigured by software instructions embodying logic operable to performfunction(s) that are loaded from memory, e.g., RAM, ROM, firmware,and/or virtual memory. In example embodiments where circuitry includes acombination of hardware and software an implementer may write sourcecode embodying logic that is subsequently compiled into machine readablecode that can be processed by the logical processor. Since one skilledin the art can appreciate that the state of the art has evolved to apoint where there is little difference between hardware, software, or acombination of hardware/software, the selection of hardware versussoftware to effectuate specific functions is a design choice left to animplementer. More specifically, one of skill in the art can appreciatethat a software process can be transformed into an equivalent hardwarestructure, and a hardware structure can itself be transformed into anequivalent software process. Thus, the selection of a hardwareimplementation versus a software implementation is one of design choiceand left to the implementer.

Referring now to FIG. 1, an exemplary general purpose computing systemis depicted. The general purpose computing system can include aconventional computer 20 or the like, including a general purposeprocessing unit 21 that can include one or more logical processors, asystem memory 22, and a system bus 23 that couples various systemcomponents including the system memory to the processing unit 21. Thesystem bus 23 may be any of several types of bus structures including amemory bus or memory controller, a peripheral bus, and a local bus usingany of a variety of bus architectures. The system memory includes readonly memory (ROM) 24 and random access memory (RAM) 25. A basicinput/output system 26 (BIOS), containing the basic routines that helpto transfer information between elements within the computer 20, such asduring start up, is stored in ROM 24. The computer 20 may furtherinclude a hard disk drive 27 for reading from and writing to a harddisk, not shown, a magnetic disk drive 28 for reading from or writing toa removable magnetic disk 29, and an optical disk drive 30 for readingfrom or writing to a removable optical disk 31 such as a CD ROM or otheroptical media. In some example embodiments computer executableinstructions embodying aspects of the present disclosure may be storedin ROM 24, hard disk (not shown), RAM 25, removable magnetic disk 29,optical disk 31, and/or a cache of general purpose processing unit 21.The hard disk drive 27, magnetic disk drive 28, and optical disk drive30 are connected to the system bus 23 by a hard disk drive interface 32,a magnetic disk drive interface 33, and an optical drive interface 34,respectively. The drives and their associated computer readable mediaprovide non volatile storage of computer readable instructions, datastructures, program modules and other data for the computer 20. Althoughthe exemplary environment described herein employs a hard disk, aremovable magnetic disk 29 and a removable optical disk 31, it should beappreciated by those skilled in the art that other types of computerreadable media which can store data that is accessible by a computer,such as magnetic cassettes, flash memory cards, digital video disks,Bernoulli cartridges, random access memories (RAMs), read only memories(ROMs) and the like may also be used in the exemplary operatingenvironment.

A number of program modules may be stored on the hard disk, magneticdisk 29, optical disk 31, ROM 24 or RAM 25, including an operatingsystem 35, one or more application programs 36, other program modules 37and program data 38. A user may enter commands and information into thecomputer 20 through input devices such as a keyboard 40 and pointingdevice 42. Other input devices (not shown) may include a microphone,joystick, game pad, satellite disk, scanner or the like. These and otherinput devices are often connected to the general purpose processing unit21 through a serial port interface 46 that is coupled to the system bus,but may be connected by other interfaces, such as a parallel port, gameport or universal serial bus (USB). A display 47 or other type ofdisplay device can also be connected to the system bus 23 via aninterface, such as a video adapter 48. In addition to the display 47,computers typically include other peripheral output devices (not shown),such as speakers and printers. The exemplary system of FIG. 1 alsoincludes a host adapter 55, Small Computer System Interface (SCSI) bus56, and an external storage device 62 connected to the SCSI bus 56.

The computer 20 may operate in a networked environment using logicalconnections to one or more remote computers, such as a remote computer49. The remote computer 49 may be another computer, a server, a router,a network PC, a peer device or other common network node, and typicallycan include many or all of the elements described above relative to thecomputer 20, although only a memory storage device 50 has beenillustrated in FIG. 1. The logical connections depicted in FIG. 1 caninclude a local area network (LAN) 51 and a wide area network (WAN) 52.Such networking environments are commonplace in offices, enterprise widecomputer networks, intranets and the Internet.

When used in a LAN networking environment, the computer 20 can beconnected to the LAN 51 through a network interface or adapter 53. Whenused in a WAN networking environment, the computer 20 can typicallyinclude a modem 54 or other means for establishing communications overthe wide area network 52, such as the Internet. The modem 54, which maybe internal or external, can be connected to the system bus 23 via theserial port interface 46. In a networked environment, program modulesdepicted relative to the computer 20, or portions thereof, may be storedin the remote memory storage device. It will be appreciated that thenetwork connections shown are exemplary and other means of establishinga communications link between the computers may be used. Moreover, whileit is envisioned that numerous embodiments of the present disclosure areparticularly well-suited for computerized systems, nothing in thisdocument is intended to limit the disclosure to such embodiments.

Referring now to FIG. 2 and 3, they depict high level overviews ofcomputer systems including circuitry for virtualizing resources that canbe used in aspects of the present disclosure. As shown by the figure,computer 200 can include physical hardware devices such as storagedevice 208, e.g., a hard drive, a network interface controller (NIC)210, e.g., a network interface card or Ethernet adapter, a graphics card234, at least one logical processor 212 and random access memory (RAM)214. One skilled in the art can appreciate that while one logicalprocessor is illustrated in other embodiments computer 200 may havemultiple logical processors, e.g., multiple execution cores and/ormultiple processors. In these embodiments multiple threads can beexecuted at the same time, e.g., one or more threads per logicalprocessor. Continuing with the description of FIG. 2, depicted is ahypervisor 202 that may also be referred to as a virtual machinemonitor. The hypervisor 202 in the depicted embodiment includesexecutable instructions for controlling and arbitrating access to thehardware of computer 200. The hypervisor 202 can generate executionenvironments called partitions such as partition 1 and partition N(where N is an integer greater than 1.) In embodiments of the presentdisclosure a partition can be considered the basic unit of isolationsupported by the hypervisor 202, that is, each partition can be mappedto a set of hardware resources, e.g., memory, devices, logical processorcycles, etc., that is under control of the hypervisor 202. In anembodiment the hypervisor 202 can be a stand alone software produce, apart of an operating system, embedded within firmware of the motherboardor a portion of the hypervisor 202 can be effectuated by specializedintegrated circuits.

Continuing with the description of FIG. 2, the computer 200 can includea root partition 204 that may include a virtualization service provider228 (VSP.) In this example architecture the root partition 204 canaccess the underlying hardware via device drivers 224. The VSP 228 inthis example can effectuate interfaces in partitions know as children,and these children can be considered virtual machines. Thevirtualization service provider 228 effectuates virtual machines 216 and218 by instantiating different classes of devices as software andexposes interfaces to the devices within the partitions. Each virtualmachine can include a virtual processor such as virtual processors 230and 232 that guest operating systems 220 and 222 can manage and schedulethreads to execute thereon. Generally, the virtual processors 230 and232 are executable instructions and associated state information thatprovides a representation of a physical processor with a specificarchitecture. For example, one virtual machine may have a virtualprocessor having characteristics of an Intel 80X86 processor, whereasanother virtual processor may have the characteristics of a Power PCprocessor. The virtual processors in this example can be mapped tological cores of the computer system such that the instructions thateffectuate the virtual processors will be backed by logical processors.Thus, in these example embodiments multiple virtual processors can besimultaneously executing while, for example, another logical processoris executing hypervisor instructions.

Continuing with the description of FIG. 2, it additionally illustrates abalancer 226. The balancer 226 can include computer executableinstructions that can balance hardware usage among a plurality ofclients using a variety of techniques to reduce resource starvationexperienced by a client and maximize throughput. As is illustrated bythe dashed lines of FIG. 2, the balancer 226 can be loaded within thecomputer executable code that effectuates the hypervisor 202 or in otherembodiments the balancer 226 can be part of the code that effectuatesthe root partition 204. The balancer 226 can in other embodiments be astand alone piece of code that is not part of another piece of code,e.g., the balancer 226 does not have to be part of the hypervisor 202 orthe root partition 204 and the disclosure is not limited to the depictedembodiments. The balancer 226 can additionally be part of a driver for ahardware device. In this example driver developers can augment theexisting algorithms used to maximize throughput with techniquesdescribed herein. As shown by the figure, the balancer 226 canadditionally be embedded within the physical hardware devices in theform of specialized circuits or firmware.

Referring now to FIG. 3, it illustrates an alternative architecture thatcan be used to practice embodiments of the present disclosure. FIG. 3depicts similar components to those of FIG. 2, however in this exampleembodiment the hypervisor 202 can include the virtualization serviceprovider 228 and device drivers 224, and the root 204 can containconfiguration utilities 236. In this architecture the hypervisor 202 canperform the same or similar functions as the hypervisor 202 of FIG. 2.The hypervisor 202 of FIG. 3 can be a stand alone software produce, apart of an operating system, embedded within firmware of the motherboardor a portion of the hypervisor 202 can be effectuated by specializedintegrated circuits. In this implementation the hypervisor 202 can bethought of as instructions that execute directly on the bare metal ofthe hardware. In this example the root partition 204 may haveinstructions that can be used to configure the hypervisor 204 howeverhardware access requests may be handled by the hypervisor 202 instead ofbeing passed to the root partition 204. Similar to that above, thebalancer 226 can be included within the instructions that effectuate thehypervisor 202, the instructions that effectuate the root partition 204,any other place within the computer system 200, or by hardware.

In embodiments of the present disclosure the balancer 226 is operable tomanage the flow of IO jobs from a client to a hardware device such thatresource starvation is reduced and high throughput is obtained.Generally, and throughout the disclosure, concepts will be describedusing units of time instead of byte count or IO job count for ease ofexplanation and the disclosure is not limited to implementations wherecalculations are based in and on time. That is, in other exampleimplementations the disclosed algorithms can be modified to be based onIO job count or byte count since there are relationships between IOjobs, bytes in IO jobs, and time that will be described in more detailbelow and in the related applications.

The balancer 226 can calculate the throughput of the hardware device inorder to attempt to maximize the hardware device's throughput. Hardwaredevices do not generally provide any meaningful information aboutthroughput, thus alternative techniques need to be used. In exampleembodiments the throughput of the hardware device can be obtained usingthe amount of time required to complete IO jobs pending in the hardwaredevice (the time cost of pending IO jobs.) For example, time costrepresents an estimated amount of time that the hardware device willrequire in order to complete an IO job. Or put another way, time costrepresents the amount of ‘dedicated’ time that the hardware device willtake to execute a given IO job and return a completion signal to thebalancer 226. If a hardware device can only execute one IO job at atime, then the IO time cost of an IO job is just the time duration fromwhen the IO job is issued to the hardware until the hardware completesthe IO job. In this example the entire time duration is dedicated to theone IO job because the hardware can't make progress on more than one IOjob at a time. In another example a storage device may have 16 separatedrives and can execute 16 IO jobs at a time. In this example theduration of time from when the IO job is issued until it completes isnot equivalent to its IO time cost. In this example the IO time cost maybe as low as 1/16^(th) of the duration.

The throughput of a hardware device can be calculated from the time costfor the IO jobs that are pending in the hardware device. Each IO jobthat is pending in the hardware device, e.g., in-flight, can have a timecost and the total time cost for the pending IO jobs can represent howmuch ‘work’ the hardware device has. Generally, the time cost for an IOjob can be estimated based on the characteristics of the IO job itself.Each characteristic can be associated with a cost factor, e.g., a scalarthat represents how expensive the characteristic is. The balancer 226can multiply each characteristic by its corresponding cost factor andthe total number can be the time cost for the IO job. In other exampleembodiments techniques described in U.S. application Ser. No. ______(Attorney Docket No. MVIR—0207/MS-324517.01) entitled “HARDWARETHROUGHPUT SATURATION DETECTION” can be used to estimate an IO job'stime cost.

From the estimated total amount of ‘work’ that the hardware device haspending the maximum throughput of the hardware device can be obtainedusing techniques described in U.S. patent application Ser. No. ______(Attorney Docket No. MVIR—0208/MS-324518.01) entitled “TEMPORAL BATCHINGOF I/O JOBS” and/or U.S. application Ser. No. ______ (Attorney DocketNo. MVIR—0207/MS-324517.01) entitled “HARDWARE THROUGHPUT SATURATIONDETECTION.” Generally, as the time cost of the pending IO jobs increasesso does achieved throughput. This is because hardware devices such asstorage devices complete IO jobs in accordance with internal algorithms(performed either in hardware, firmware, or in the driver) that attemptto select IO jobs to execute so that the currently pending IO jobs canbe completed within the shortest period of time, among other selectioncriteria. This is most efficiently accomplished when the hardware devicehas a plethora of IO jobs to select from. Generally, as time cost ofpending IO jobs increases so does throughput up to a saturation point,or a point where the addition time cost of an additional IO job providesno significant additional hardware throughput. In an embodiment thesaturation point can be used as a target latency value, or a time costof pending IO jobs that the balancer 226 wants to keep the hardwaredevice above in order to achieve high throughput.

In order to achieve high throughput the balancer 226 can keep thehardware saturated with IO jobs and in order to reduce starvation thebalancer 226 can use techniques described herein to select which IO jobsto send to the hardware. For example, IO jobs can be sent to thehardware device based on the amount of time a client used the hardwaredevice. As the balancer 226 sends more IO jobs associated with oneclient to the hardware device the client's allocated amount of time canbe used up. When a client uses up their allotted time client IO jobs canbe stored in a queue and other IO jobs from other clients can be sent tothe hardware device. Generally speaking, the balancer 226 can attempt tokeep the hardware device saturated with IO jobs from one client, andthen keep the hardware device saturated with IO jobs from anotherclient. In this implementation, throughput is high, and resourcestarvation experienced by clients is relatively low compared to thesituation where one client is dominating the hardware device.

In one example implementation ‘flows’ are used by the balancer 226 tokeep track of which client has overused the hardware device and whichclient can use the hardware device. For example, a flow can representthe IO jobs being issued from a specific client to a specific hardwaredevice. Thus, if there are two hardware devices a client could have twoflows, e.g., one for each hardware device. In an implementation eachflow can be a value that represents the total amount of time the clientcan use or has overused the hardware device. Conceptually speaking apositive value can represent time a client can use whereas a negativevalue can represent how much the client overused a hardware device.While the terms ‘positive’ and ‘negative’ are used throughout thedisclosure one skilled in the art can appreciate that this is to providea simple way to illustrate concepts and that the terms ‘positive’ and‘negative’ are not limited to their literal meaning. That is, in anembodiment a ‘negative’ value could be any information that can beinterpreted by a computer as meaning that a client has overused thehardware whereas a positive number can be any information that can beinterpreted by a computer as meaning the client has time available onthe hardware device. One of skill in the art can appreciate that inembodiments where the balancer 226 is configured to provide short termbalance the flows may not go negative. That is, a client may not overusea hardware device. In certain embodiments however the cost of switchingflows may be higher than the cost of allowing the client to overuse thehardware device, thus in these and other embodiments the balancer 226may be configured to allow a client to overuse the hardware device inorder to keep throughput high.

FIG. 4 provides an example that can be used to illustrate the concept of‘flows.’ FIG. 4 generally provides a pictorial representation of a datastructure 400 that the balancer 226 can maintain in order to balancehardware usage among clients. As was stated above, in an embodiment eachclient using a hardware device can have an associated flow and the flowcan be positive or negative (for example the flow for client 1 ispositive whereas the flow for client 4 is negative.) In this example apositive value can represent an amount of time a hardware device canspend completing IO jobs from its associated client before subsequentjobs will be queued. A negative number can represent the amount of timethat the client overused the hardware device. The issue point in thisimplementation can be a value that indicates the degree to which a flowhas used too much time of the hardware device relative to other flows.In a specific implementation a flow's value can be represented as thedifference between two numbers stored in RAM, e.g., a number indicativeof the issue line and a number indicative of the issue point for theflow. In an example the difference could be positive, that is the issueline could be more positive than the issue point. In this example theissue line could be 20 ms, the issue point for client flow 1 could be 10ms and the difference can be 10 ms (which could be indicative of apositive flow.) On the other hand the issue point for client 3 flowcould be 30 ms and the difference between the issue line and the issuepoint could be −10 (which indicates that the flow is negative.)

The following are a series of flowcharts depicting implementations ofprocesses. For ease of understanding, the flowcharts are organized suchthat the initial flowcharts present implementations via an overall “bigpicture” viewpoint and subsequent flowcharts provide further additionsand/or details. Those having skill in the art will appreciate that thestyle of presentation utilized herein generally allows for a rapid andeasy understanding of the various operational procedures that form apart of the present disclosure.

Referring now to FIG. 5, it illustrates an operational procedure forbalancing usage of a hardware device including the operational procedure500-506. Operation 500 begins the operational procedure and operation502 shows receiving an IO job associated with a client. For example, andreferring to FIG. 2 and/or FIG. 3, the balancer 226 can receive an IOjob from a client such as, for example, virtual machine 216. In anembodiment the processor 212 can execute instructions indicative of theroot partition 204 and the balancer 226. The balancer 226 can have amemory location that is shared with the virtual machine 216, e.g., aring buffer or a self overwriting memory location. The IO job in thisexample can be a job for a storage device 208, e.g., a read, write, aflush, etc., a job for a NIC 210, e.g., a request to send one or morepackets of information, or a draw command for a graphics card. In thisexample the balancer 226 can access the shared memory location andreceive information that identifies the request and, for example, apointer to the data. In an embodiment where the balancer 226 is embeddedwithin the hardware device the IO request could be received from thedevice driver 224. In this example, information that identifies whichclient the request is associated with can be sent to the hardwaredevice. In yet another implementation the balancer 226 can beeffectuated by instructions that are a part of the hypervisor 202. Inthis example the client can place the request in the shared memorylocation and the hypervisor 202 can be executed and the job can bepassed to the balancer 226.

Continuing with the description of FIG. 5, operation 504 depictsdetermining that a hardware device has spent an estimated amount of timecompleting jobs associated with the client that exceeds an amount oftime that was allocated to complete IO jobs from the client. Forexample, in embodiments of the present disclosure the balancer 226 canbe configured to regulate how much time the hardware device can spendprocessing IO jobs from a given client by determining whether the clienthas already used an amount of time that it was allotted, e.g., whetherthe client has a positive flow. In this example as an IO job is receivedfrom the client the balancer 226 can estimate how long it will take thehardware device to complete the job based on factors such as the numberof bytes in the request, the type of request, e.g., read or write,overhead associated with processing any request, whether the requestinvolves a flow switch or is in non-sequential order (in the storagedevice example), etc., and a determination can be made as to whether theclient has any time available on the hardware device. In the same, andother embodiments the balancer 226 can use techniques described in U.S.application Ser. No. ______ (Attorney Docket No. MVIR—0207/MS-324517.01)entitled “HARDWARE THROUGHPUT SATURATION DETECTION.”

In a specific example of operation 502 processor 212 can execute theinstructions indicative of the balancer 226 and each client can beassigned a value indicative of the amount of time that the hardwaredevice can spend completing its IO jobs, for example 5 ms. A specificclient in this example may send an amount of IO jobs to the balancer 226and the balancer 226 may estimate that it will take 20 ms for thehardware device to complete the IO jobs; and send all of the jobs to thehardware device. In this example information that identifies that theclient is estimated to have gone over it's allotted time, e.g., by 15ms, can be stored in memory. Subsequently the client may send anotherset of IO jobs to the balancer 226 and the balancer 226 can determinethat the client has previously gone over an amount of time that wasallocated to service IO jobs from the client.

Continuing with the description of FIG. 5, operation 506 shows storingthe IO job in a queue. For example, and continuing with the previousexample, once the determination is made that the client has used up itsallotted amount of time the request can be stored in a queue along with,for example, information that identifies the client associated with therequest and information that identifies the estimated amount of time itwill take for the hardware device to complete the request. In an exampleimplementation, one in which the balancer 226 is not part of thehardware device, each hardware device can include a buffer where pendingIO jobs are stored and the hardware device will select jobs to completefrom a buffer based on a hardware algorithm that maximizes throughput.The balancer 226 can be used in this embodiment to determine which jobsare placed in the hardware device's buffer. In a hardwareimplementation, the hardware device can include information thatidentifies the source of the IO job, e.g., which client the job camefrom. In this example the balancer 226 can work in conjunction with theinternal algorithms to force the hardware device to switch from jobsthat maximize throughput to jobs that are potentially less efficient butwhich represent a better balance among clients.

In either implementation by storing the IO job in a queue the end resultis that the hardware device will complete other jobs it has in itsbuffer. This emergent behavior is desirable because a hardware devicemay have a bias towards a stream of IO jobs from one client because thestream is more efficient for the hardware device to complete. As thehardware device spends more and more of its processing time completingjobs from a given client, the balancer 226 will send fewer and fewerjobs from that client to the hardware device's buffer and instead storethem in the balancer queue. Eventually the hardware device may not haveany jobs from the client and the hardware device will be forced tocomplete other jobs for other clients. This emergent behavior isdesirable in embodiments that include clients such as virtual machinesand/or terminal servers because if the hardware device has a biastowards a particular virtual machine the other virtual machines(s) willnot have their jobs completed within a reasonable amount of time.

Referring now to FIG. 6, it depicts an alternative embodiment of theoperational procedure 500 of FIG. 5 including the additional operations608, 610, 612, and 614. Referring now to operation 608 it illustratesreceiving an IO job completion signal from the hardware device;determining that estimated completion times for IO jobs pending in thehardware device total to a completion time value that is lower than apredetermined value; and sending the IO job to the hardware device. Forexample, in an embodiment of the present disclosure the IO job or jobsfrom the client can be stored in the balancer queue. In this exampleembodiment an IO job completion signal can be received from the hardwaredevice, e.g., a signal that indicates that jobs that were previouslysent to the hardware device at an earlier time are finished, and thebalancer 226 can be run, e.g., the processor 212 can execute theinstructions indicative of the balancer 226. The balancer 226 in thisexample can determine the estimated amount of time that it will take forthe hardware device to complete the IO jobs that are currently ‘inflight’ from the perspective of the balancer 226, e.g., the jobs are ‘inflight’ because they have been sent to the hardware device andcompletion signals have not been received for the IO jobs, and determinewhether the total is less than a predetermined value. For example, in anembodiment the predetermined value can be a value set by anadministrator, or as is described U.S. patent application Ser. No.______ (Attorney Docket No. MVIR—0208/MS-324518.01) entitled “TEMPORALBATCHING OF I/O JOBS” the predetermined value can be the saturationpoint of a hardware device. In this example embodiment once the balancer226 determines that the estimated time cost for in-flight IO jobs isless than the predetermined number, the IO job can be sent to hehardware device.

Referring now to operation 610 it illustrates the operational procedureof FIG. 5, wherein the client is a virtual machine. For example, in thisembodiment the client can be a virtual machine such as virtual machine216 or virtual machine 218 of FIG. 2 or FIG. 3. The virtualizationservice provider 228 can generate a software representation of ahardware device such as storage 208, a NIC 210, and/or a graphics card234 and provide an interface to the software representation of thehardware device to a partition in the form of a virtual device of avirtual machine. The guest OS 220 for example can write an IO request tothe software representation of the hardware device and the request canbe stored in a memory location shared between the balancer 226 and thevirtual machine 216. The balancer 226 can access the shared memorylocation and obtain the IO job.

Referring now to operation 612 it illustrates the operational procedureof FIG. 5, wherein the client is a terminal server session. For example,and referring to FIG. 2 or FIG. 3, in an embodiment the client can be aterminal server session such as TS session 240, 242, 244, or 246 or anyother application that executes on an operating system such as adatabase management program, a web sever application, etc. For example,a TS session in embodiment of the present disclosure can send IO jobs tothe executive of the guest operating system 220 and these requests canbe balanced against other jobs from other TS sessions. In this exampleIO jobs can be tagged with information that identifies which sessionthey are from and fed into the balancer 226. In this example thebalancer 226 can be configured to balance among virtual machines andamong applications that execute on the virtual machines such as theterminal server sessions. In this example situations may exist where theterminal server sessions are balanced and the virtual machines arethemselves balanced. As is illustrated by FIGS. 2 and 3, the TS sessionsare executing on virtual machines however in other embodiments the TSsessions may be executing on an operating system that is executing onthe bare hardware.

Continuing with the description of FIG. 6, additionally illustrated isoperation 614 that shows receiving an IO job associated with a secondclient; determining that the second client is associated withinformation that identifies an amount of time that the hardware devicecan spend completing job requests from the second client; and sendingthe IO job request associated with the second client to the hardwaredevice. For example, in an embodiment of the present disclosure thebalancer 226 can receive an IO job from a client such as virtual machine218 and determine that the job request is from a client that has anallocated amount of time on the hardware device. For example, thebalancer 226 can access a memory that stores an amount of timeassociated with the client. In an embodiment if the memory includes, forexample, a positive amount of time the IO job can be sent to thehardware device. Additionally or alternatively, the processor 212 canexecute instructions indicative of the balancer 226 and determine howlong it will take the hardware device to complete the job usingtechniques similar to those described above and reduce the amount oftime allocated to the second client by the estimated amount.

In at least one embodiment the job can comprise a plurality of IO jobsand the balancer 226 can determine how long it will take the hardwaredevice to complete the jobs. In one embodiment all the jobs can beissued even if the estimated amount of time is greater than the allottedamount of time, or in other embodiments a subset of jobs that have anestimated time cost less than or equal to the allotted time can be sentto the hardware device and the remainder can be stored in the balancerqueue using techniques described in U.S. patent application Ser. No.______ (Attorney Docket No. MVIR—0208/MS-324518.01) entitled “TEMPORALBATCHING OF I/O JOBS.” In this example if a client sends a lot ofrequests to the balancer 226 that have a total estimated amount of timegreater than how much was allocated to it the client will be allowed to‘burst,’ e.g., send a stream to the hardware device until the clientruns out of allocated time on the hardware device and then the remainingIO job requests will be queued along with the jobs from other clientsthat depleted, i.e., used or spent, their allocated amount of time.

Referring now to FIG. 7, it illustrates an alternative embodiment of theoperational procedure 500 of FIG. 6 including the additional optionaloperations 716 and 718. Operation 716 shows determining that the amountof time that the hardware device can spend completing job requests fromthe second client exceeds a predetermined maximum amount of time; andreducing the amount of time that the hardware device can spendcompleting job requests from the second client to the predeterminedmaximum amount of time. For example, in embodiments of the presentdisclosure the balancer 226 can be set to identify a maximum amount oftime that a client can have allocated to it and if the amount of timethat the hardware device can spend completing job requests from theclient exceeds that limit the balancer 226 can reduce the amount ofallocated time to the maximum. For example, in an embodiment thebalancer 226 can add time to each client's flow and if a client does notsend IO jobs for an entire day their flow could increase to an amountwhere the client could potentially burst to the hardware device for along time. In embodiments that include the predetermined maximum limitthis behavior is prevented by sacrificing long term balance in order toallow for increased short term performance. That is, by setting amaximum limit individual clients can not burst for a long time whichwould significantly increase latency experienced by other clients.

In a specific example the second client, e.g., virtual machine 216, maynot issue any IO jobs for 5 hours and may have an amount of allocatedtime equal to an hour. The balancer 226 in this example may be balancing3 other clients that are issuing IO jobs on a relatively continuousbasis and virtual machine 216 may then send an estimated 30 secondsworth of IO jobs to the hardware device. If for example, the balancer226 was operating without the predetermined maximum amount of time allestimated 30 seconds of IO jobs may be sent to the hardware device. Inthis example the other 3 clients that were issuing continuous IO jobswill have to wait perhaps 30 seconds before their jobs are serviced. Inthis situation long term balance was achieved because virtual machine216 ‘saved’ that time by not sending jobs all the time, however theother 3 clients could be resource starved. In the example where thebalancer 226 was operating with the predetermined maximum amount of timethe first, for example, the allocated amount of time could be reducedfrom an hour to 4 seconds. In this example the first 4 seconds worth ofIO jobs can be sent to the hardware device and then the 26 seconds worthof IO jobs could be balanced along with the jobs from the other 3clients. In this example long term fairness is sacrificed for betteroverall system performance.

Continuing with the description of FIG. 7, operation 718 shows reducingthe amount of time that the hardware device can spend completing jobrequests from the second client based on a priority level associatedwith the client. In an example embodiment when the IO job or jobs fromthe second client are sent to the hardware device the amount of timethat the balancer 226 estimates the hardware device will need tocomplete the IO job or jobs can be subtracted from the amount of timethat was allocated to service jobs from the second client. In an examplethe estimated amount of time needed to complete the IO jobs can bemodified by a scalar factor indicative of the client's priority prior tobeing subtracted. For example, in an embodiment each client can beassigned a priority level by an administrator that is indicative of howimportant the administrator thinks the client is. In this example,clients associated with a higher priority level can have more time onthe hardware device than other clients. In a specific example thepriority level for a first client can be 1, a second client can be 2 andeach client has 10 ms of allocated time on the device. In this specificexample the balancer 226 can charge the first client twice as much asthe second client. That is, if a 5 ms worth of IO jobs are received bythe balancer 226 for client 1, the balancer 226 may reduce the allottedtime by 10 ms whereas if the jobs were from client 2 the balancer 226may have reduced the allocated amount of time by 5 ms.

Referring now to FIG. 8, it illustrates an alternative embodiment of theoperational procedure 500 of FIG. 7 including the additional optionaloperation 820 that shows the operational procedure of FIG. 5, whereinthe predetermined maximum amount of time is dynamically updated based onaverage latency of IO jobs. For example, in an embodiment of the presentdisclosure instead of being configured by an administrator, thepredetermined maximum amount of time that a client can have on thehardware device can be dynamically updated. In one implementation, theinitial predetermined maximum amount of time can be set to a largenumber and scaled back based on the average latency of IO job completionsignals. For example, in the instance that a client is bursting to thehardware device, e.g., sending 10 seconds worth of data to the hardwaredevice, the balancer 226 can be configured to determine the averageamount of time it took for each job from the time it was sent from thebalancer 226 until a competition signal is received from the hardwareand compares that to the average amount of time it took for jobs fromother clients that have an allotted amount of time to use the hardwaredevice to be completed. If, for example, the difference is 2 times asmuch then the predetermined maximum amount of time can be reduced.

Referring now to FIG. 9, it illustrates an operational procedure forpracticing aspects of the present disclosure including operations 900,902, 904, 906, 908, and 910. Operation 900 begins the operationalprocedure and operation 902 shows storing a value indicative of anamount of time a hardware device can spend completing IO jobs from theclient. For example, a value can be stored in memory such as RAM thatcan be indicative of the amount of time that a hardware device can spendprocessing IO requests from a client. For example, in an embodiment thevalue can be a number of milliseconds. The value in this example can beused to balance hardware usage among at least two clients based on anestimate as to how long the hardware device will need to complete IOjobs.

Continuing with the description of FIG. 9, operation 904 shows receivingIO jobs associated with the client. For example, and in addition to theprevious example the balancer 226 can be run, e.g., a processor 212 canexecute code indicative of the balancer 226, and IO jobs from a client,e.g., virtual machine 218, can be obtained. For example, the balancer226 can have a memory location that is shared with virtual machine 218,e.g., a ring buffer or a self overwriting memory location. In thisexample the balancer 226 can access the shared memory location andreceive information that identifies the IO jobs and, for example, apointer to the data.

Continuing with the description of FIG. 9, operation 906 showsestimating an amount of time the hardware device will need to completethe IO jobs. For example, the balancer 226 can in this example receivethe IO job requests and estimate how long it will take to complete therequests. In this example the balancer 226 can estimate how long it willtake the hardware device to complete the jobs based on factors such asthe operating characteristics of the hardware device, number of bytes inthe request, the type of request, e.g., read or write, overheadassociated with processing any IO job, whether the request involves aflow switch or is in non-sequential order (in the storage deviceexample), etc. In other example embodiments the estimation can beobtained using techniques described in U.S. application Ser. No. ______(Attorney Docket No. MVIR—0207/MS-324517.01) entitled “HARDWARETHROUGHPUT SATURATION DETECTION.” In one embodiment the balancer 226 canbe part of the driver for the hardware device. In this example aprocessor 212 can execute instructions that effectuate the driver andestimate how long it will take the hardware device to complete the jobsthat it received, e.g., jobs stored in a shared memory location.

Continuing with the description of FIG. 9, operation 908 shows revisingthe value based on the estimated amount of time required to complete theIO jobs. For example, after the estimated time it will take to completethe jobs is determined, the value indicative of the amount of time thehardware device can spend working on IO jobs from the client can berevised. In one embodiment, and referring to FIG. 4, the client could beclient 1 having a ‘positive’ flow, e.g., a value that represents thatthe client has available time on the hardware device. The value in thisexample can represent a time value such as 15 ms. In this example thevalue can be revised, e.g., reduced, by an amount based on the estimatedtime that it will take to finish the IO jobs. For example, if theprocessor 212 executes the balancer code and determines that theestimated amount of time it will take for the hardware device tocomplete the jobs is 10 ms then the positive time value associated withclient 1 can be reduced by 10 ms. If for example the estimated amountwas 20 ms, in one embodiment the processor 212 can execute the balancercode and reduce the value to 0 and store the IO jobs that make up theremaining 5 ms in the queue. In an alternative implementation thebalancer 226 could issue the entire 20 ms of IO jobs to the hardwaredevice and revise the value to make it ‘negative,’ e.g., by assigning anumber to the value that represents that the client has overused itsallotted time on the hardware device.

Continuing with the description of FIG. 9, operation 910 shows sendingthe IO jobs to the hardware device. For example, and in addition to theprevious example, the IO jobs can be sent to the hardware device. In oneembodiment this can include sending all the jobs that were received inoperation 904, however in other embodiments this can include sending aportion of the received IO jobs such as is described in U.S. patentapplication Ser. No. ______ (Attorney Docket No. MVIR—0208/MS-324518.01)entitled “TEMPORAL BATCHING OF I/O JOBS.” For example, and describedabove, in one embodiment if the value is reduced to 0 then the remainingjobs can be stored in the balancer queue. In an embodiment where thebalancer 226 is located in the root, sending the IO jobs to the hardwaredevice can include, but is not limited to sending, by the balancer 226,the IO jobs to the driver associated with the hardware device.

Referring now to FIG. 10, it illustrates an alternative embodiment ofthe operational procedure 900 of FIG. 9 including the operations 1012,1014, and 1016. Referring to operation 1012, it shows determining thatthe amount of time the hardware device can spend completing IO jobs fromthe client is greater than a maximum amount of time a client can use thehardware device; and reducing the amount of time the hardware device canspend completing IO jobs to the maximum amount of time. For example, inan embodiment the balancer 226 can be executed by a logical processorsuch as processor 212 and the processor 212 can determine that theamount of hardware processing time available to the client is greaterthan a maximum amount of time that can be available to the client andreduce the amount available to the maximum amount. For example, inembodiments of the present disclosure resource starvation can be reducedor avoided at the sacrifice of long term fairness. Resource starvationgenerally refers to the instance where the client can not access thehardware and in turn can not make acceptable process. In the instancewhere the maximum amount of time available to the client is unboundedthen a client could potentially obtain an amount of time on the hardwaredevice that will take a very long time to complete. If the unboundclient has a significant amount of IO jobs the client could burst to thehardware device for a long time. In embodiments that include a maximumamount of time this behavior is prevented thereby sacrificing long termfairness to prevent a situation where one client's IO jobs could use thehardware device for a long time and IO jobs from other clients wouldhave to wait.

Continuing with the description of FIG. 10, it illustrates operation1014 that shows revising the value based a priority level for theclient. For example, in an embodiment the value can be revised based onthe priority level associated with the client. In an embodiment anadministrator can assign priority levels to different clients and thebalancer 226 can be used to ensure that the hardware device received IOjobs in a way that honors the client's priority. In one implementationthe value can be revised by increasing the amount of time a hardwaredevice can spend completing IO jobs from the client by an amount inproportion to its priority. In this example the balancer 226 can addtime to a given client's available amount based on its priority level,that is, a higher priority client can be given more time. In anotherembodiment the value can be revised by, for example, reducing, the valueat a rate based on the client's priority. For example, when the value isrevised based on the estimated amount of time it will take to completeIO jobs, the estimated amount can be modified by a scalar factorindicative of the client's priority. Instructions that effectuate therevision can be executed using different techniques. For example, in anembodiment the revision instructions can be executed based on thepassage of time, e.g., a timer could expire and the balancer 226 can addto ‘clients’ values, based on completion signals. That is, in animplementation time can be added to each client's flow based on thepassage of time. In another implementation, such as example embodimentsdescribed above, the receipt of a completion signal can trigger theexecution of the instructions that effectuate the revision.

Continuing with the description of FIG. 10, operation 1016 showsreceiving additional IO jobs from the client; determining that theclient has overused the hardware device based on the revised value; andstoring the additional IO jobs in a queue. In an example embodiment thebalancer instructions can be run by the processor 212 and the balancer226 can receive additional instructions from the client. The processor212 can execute the balancer 226 and a determination can be made thatthe amount of time the hardware device can spend completing IO jobs fromthe client has been used up, e.g., the flow is negative such as theflows associated with clients 3 and 4. In this example the additionaljobs can be stored in a queue associated with the balancer 226. In aspecific example the client may have had a positive value indicative of10 ms and the client may have sent 20 ms worth of IO jobs to thebalancer 226. The balancer 226 in this example can issue the 20 ms worthof IO jobs to the hardware device and store a value in memory indicativeof the fact that the client overused the hardware device by 10 ms.Subsequently the client may send another 20 ms with of IO jobs to thebalancer 226. The balancer 226 in this example can determine that theclient overused the hardware device by 10 ms and the balancer 226 canstore the 20 ms worth of IO jobs in a queue.

Referring now to FIG. 11, it illustrates an alternative embodiment ofthe operational procedure 900 of FIG. 10. FIG. 10 shows optionaloperation 1118 that depicts storing an IO job associated with a secondclient in the queue; and storing a second value indicative of the amountof time the second client has overused the hardware device. In thisexample the balancer 226 can maintain multiple values for multipleclients and in this example the values can indicate that the clientoverused the hardware device. For example, in an embodiment the balancer226 can store values for clients such as virtual machines and values forapplications that execute on the virtual machines together in a singlequeue. That is, for an application the balancer 226 will be balancingbetween applications executing on the virtual machines and balancingbetween virtual machines.

Referring now to FIG. 12, it illustrates an alternative embodiment ofthe operational procedure 900 of FIG. 11. FIG. 12 shows optionaloperation 1220 that depicts determining that an estimated amount of timeassociated with jobs issued to the hardware device is lower than apredetermined value; increasing the value and the second value;determining that the value is greater than the second value; sending theadditional IO jobs associated with the client to the hardware device;and revising the value based on an additional estimated amount of timerequired to complete the additional IO jobs. For example, the balancer226 in this example can determine the estimated amount of time that itwill take for the hardware device to complete the jobs that arecurrently ‘in flight’ to the hardware is lower than a predeterminedvalue. For example, a value indicative of hardware saturation and thebalancer 226 can increase the values for the clients, e.g., each valuecan be increased the same amount or increased by different amounts basedon, for example, the priority of the client. In either case the balancer226 can determine that the value associated with the client is greaterthan the value associated with the second client; issue the client's IOjobs; and revise the value based on the estimated time cost for theadditional IO jobs.

Referring now to FIG. 13 it illustrates an operational procedure forbalancing IO requests including operations 1300, 1302, 1304, 1306, 1308,and 1310. Operation 1300 begins the operational procedure and operation1302 shows storing a plurality of negative time values, each negativetime value associated with a client, each negative time value beingindicative of an estimated amount of time that a hardware device spentcompleting IO jobs associated with the client. For example, andreferring to FIG. 4 for illustration purposes, in an embodiment aplurality of native time values can be stored in memory accessible to abalancer 226 such as RAM or a cache built into the hardware device. Inthis example, each negative time value can be indicative of an estimatedamount of time that the hardware device spent completing IO jobs fromthe clients that was over the amount of time that was allocated to theclients. Similar to that described above, the balancer 226 can estimatehow long it will take the hardware device to complete the jobs based onfactors such as the operating characteristics of the hardware device,number of bytes in the request, the type of request, e.g., read orwrite, overhead associated with processing any request, whether therequest involves a flow switch or is in non-sequential order (in thestorage device example), etc. In other example embodiments theestimation can be obtained using techniques described in U.S.application Ser. No. ______ (Attorney Docket No. MVIR—0207/MS-324517.01)entitled “HARDWARE THROUGHPUT SATURATION DETECTION.” In a specificexample, and referring to FIG. 4, values that indicate that client 3 andclient 4 have overused the hardware device can be stored in memory. Inthis example, the values can identify how much estimated time eachclient overused the device.

Continuing with the description of FIG. 13 operation 1304 shows storinga value indicative of an issue line, the value indicative of the issueline separating positive time values from the negative values, thepositive time values associated with clients that are eligible to sendIO jobs to the hardware device. For example, and referring to FIG. 4,the issue line can be indicative of the boundary between the clientsthat can use the hardware device and the clients that have overused thehardware device. In this example the negative value many not necessarilybe a negative number and the balancer 226 can determine whether thevalue is indicative of a client having available time or indicative ofwhether the client overused the hardware device based on the value'srelationship to the issue line. In one embodiment client flow valuesless than the issue line value can be considered positive whereas valuesgreater than the issue line can be considered negative. Morespecifically, the issue line value may be 50 ms, client 6 may have avalue of 0 ms, client 5 may have a value of 5 ms, client 4 may have avalue of 60 ms, client 3 may have a value of 80 ms, client 2 may have avalue of 25 ms and client 1 may have a value of 40 ms. The balancer 226can be configured to identify which clients are associated with positivevalues and which clients are associated with negative values bysubtracting the client's value from the issue line value.

Continuing with the description of FIG. 13 operation 1306 showsreceiving a job completion signal from the hardware device. For example,in an embodiment a IO job completion signal can be received from thehardware device, e.g., a signal that indicates a job or jobs is or arefinished, and the balancer 226 can be run, e.g., the processor 212 canexecute the instructions indicative of the balancer 226. The balancer226 in this example can determine the estimated amount of time that itwill take for the hardware device to complete the jobs that are stillcurrently ‘in flight’ to the hardware and determine whether the total isless than a target latency value, e.g., a value that reflects that thehardware device is saturated with IO jobs. In this embodiment howeverthe target latency value may not be obtainable, e.g., when there are notenough IO jobs to saturate the hardware device. In this instance aminimum time cost value that reflects the minimum amount of work thatneeds to be in flight to the hardware in order to justify the additionalcost of balancing and a value equal to the target latency valuemultiplied by a scalar such as 0.8 can be calculated. For example,balancing injects additional latency into each IO job from theperspective of the client, e.g., by running the balancer 226 there is achance that a given IO job may have a slightly higher latency, howeverthis additional latency is offset by the benefits that balancingintroduces when the time cost of the IO jobs in flight is higher thanthe minimum time cost value. In this example, when the target latencyvalue can not be obtained, the actual obtainable value can be determinedand for example 80% of that value can be set as the target latency valuein the balancer 226. In this example the balancer 226 can be configuredto determine whether the time cost of IO jobs in flight to the hardwareis less than the target latency value multiplied by the scalar.

Continuing with the description of FIG. 13 operation 1308 showsadvancing the issue line an amount of time to make IO jobs associatedwith at least one negative time value eligible for sending to thehardware device. In this example, the balancer 226 can determine thatthe hardware device is not saturated for example, and advance the issueline an amount that will make at least one negative value a positivevalue. For example, and referring to FIG. 4, the balancer 226 in thisexample may determine that client 4 is the least negative, e.g., theissue line—the negative value for client 4 is less negative than theissue line—the negative value for client 3 and determine to incrementthe issue line by at least 30 ms so that the value for client 4 is equalto 0. In this example embodiment the balancer 226 can be configured tosend IO jobs associated with values equal to 0 when the issue line ismoved. In this example embodiment by incrementing the issue line thepositive time value flows will additionally be increased and thenegative time values will become less negative. In this example theclients associated with positive values can be given additional time onthe hardware device to preserve fairness between all clients. That is, aquiet client, one that has a positive value and is not using thehardware device will be given an amount of time that can be spent laterby, for example, bursting. In addition, in at least one embodiment theissue line can be advanced an additional amount using techniquesdescribed in U.S. patent application Ser. No. ______ (Attorney DocketNo. MVIR—0208/MS-324518.01) entitled “TEMPORAL BATCHING OF I/O JOBS.”

Continuing with the description of FIG. 13 operation 1310 shows sendingIO jobs that are eligible based on the advanced issue line to thehardware device. For example, and in addition to the previous example,the IO jobs that are newly eligible, e.g., IO jobs associated withclient 4 can be sent to the hardware device. In one embodiment this caninclude sending all the jobs that are pending for client 4 or a singleIO job for client 4. In another embodiment an amount can be selectedusing techniques described in U.S. patent application Ser. No. ______(Attorney Docket No. MVIR—0208/MS-324518.01) entitled “TEMPORAL BATCHINGOF I/O JOBS.” Referring to FIG. 4, the issue line may have been moved tothe right to the issue point of the flow associated with client 4, thatis, the time value of the issue line can be increased to 60 ms. In thisexample the balancer 226 can be configured to issue all the pending IOjobs associated with flows that have a value of 0 or greater. In thesame, or other embodiments the balancer 226 can be configured toincrease the issue line an amount of time equal to, for example, thelatency target value multiplied by a scalar such as 0.2 (for example,120 ms*0.2=24.) In this example client 4 would have a positive value,e.g., the value would be 4 ms (64 ms−60 ms) and the balancer 226 can beconfigured to issue any IO jobs that are associated with non-negativetime values. As one of skill in the art can appreciate, the multiplier0.2 and target latency value are exemplary and other scalars/targetlatency values can be used without departing from the spirit of thesubject matter described herein.

Referring now to FIG. 14, it shows an alternative embodiment of theoperational procedure 1300 of FIG. 13 including the operations 1412,1414, and 1416. Referring to operation 1412, it shows setting a maximumpositive time value. For example, and referring to FIG. 4, in anembodiment of the present disclosure the balancer 226 can store a valueindicative of the maximum amount of positive time that a given flow canobtain such as 4 seconds or 45 ms in the example depicted by FIG. 4 (50ms−5 ms=45 ms, or put another way the issue line minus the value ofclient 5, which is equal to 45 ms.) The maximum positive time value canbe used to set how long an individual client can potentially monopolizethe hardware device. In some instances it is more efficient for thehardware device to process a large amount of IO jobs from one client,e.g., in a storage example the client may be a virtual machine andhaving the hardware device process a large amount of IO jobs from thevirtual machine can allow for streaming. However this efficiency comesat the cost of the other clients that will be resource starved while thevirtual machine is monopolizing the hardware device. Thus, the maximumpositive time value can be set by an administrator to allow a client tomonopolize the hardware device for a limited amount of time before theclient's flow is used up and then if there are other IO jobs remainingthose jobs can be balanced along with IO jobs from other clients. If anadministrator wants to allow clients to ‘save up’ for larger bursts andbetter long term balance between smooth and bursty clients, they couldset a large maximum positive time value, or if the administrator wantsto disallow large bursts and potentially penalize bursty workloads, theycould set a small positive time value. A maximum positive time value ofzero would result in effectively no bursts allowed, where a client wouldnot be able to save up time—in this case a client that is issuing IOafter being quiet for a while would be on equal footing with a clientthat had been continuously issuing IO. Bursty clients would get lessoverall IO done because they would not be allowed to make up for losttime.

Continuing with the description of FIG. 14, operation 1414 showsreceiving IO jobs from a client associated with a positive time value;sending the IO jobs from the client associated with the positive timevalue to the hardware device; and adjusting an amount of time from thepositive time value, the amount of the amount of time calculated basedon an estimated amount of time required to complete the IO jobs sent tothe hardware device and a priority level for a client associated withthe positive time value. For example the balancer 226 can receive an IOjob from a client such as client 2 of FIG. 4 and determine that theclient has a positive time value. The IO jobs can be sent and thepositive value can be adjusted by an amount that reflects the estimatedtime cost for the IO jobs sent to the hardware device modified by thepriority of the client. For example, the balancer 226 can access amemory that stores a value equal to 25 ms (issue line value 50 ms minuspositive time value of client 2 being 25 ms.)

Generally, in an un-weighted example client 2 would be able to send 25ms worth of IO jobs to the hardware device before their jobs are storedin the queue, however in this example embodiment the positive time valuefor client 2 can be reduced at a rate equal to the estimated time costof the IO jobs modified by a scalar value. For example, in oneembodiment the positive time value can be reduced at a modified ratebased on the priority of the client. Clients with higher priority havetheir positive time reduced at slower rates than clients with lowerpriority. For example, in an embodiment each client can be assigned aweight and balancer 226 can subtract an amount from the positive timevalue using the following equation scaled_time_cost=IO job timecost*(Sum(weight of all flows)/weight of flow associated client.) In aspecific example, and referring to FIG. 4, each client can have anassigned weight value, e.g., clients 1 and 3-6 can be assigned weightsof 1 and client 2 can be assigned a weight of 5. The balancer 226 cansend 1 ms worth of IO jobs to the hardware device from client 2 andsubtract 2 ms from the positive time value associated with client 2 byusing the above described equation. In this example a weight value of 5for client 2 out of a total sum of weights 10allows client 2 to use halfof the available time on the hardware device. By using the equationabove an implementer can add time to each flow, even if the flows havedifferent weights, by changing the issue line. In this exampleembodiment the balancer 226 can maintain balance for all flows on onetimeline. As one of skill in the art can appreciate, the equation usedabove is exemplary and other equations can be used to reduce a valueassociate with a client's flow without departing from the spirit of thesubject matter described herein.

Continuing with the description of FIG. 14, operation 1416 showsadjusting an amount of time from the time value associated with theeligible IO jobs, the amount of time calculated based on an estimatedamount of time required to complete the IO jobs sent to the hardwaredevice and a priority level for a client associated with the newlypositive time value. For example, and referring to example operation1310, the balancer 226 can move the issue line ahead 24 ms and issue IOjobs associated with any positive flows, e.g., flow 4 continuing theexample. In this embodiment the balancer 226 can adjust the client'sflow at a rate equal to the estimated time cost of the IO jobs modifiedbased on the priority of the client using an equation similar to thatdescribed above with respect to operation 1414.

Referring now to FIG. 15, it shows an alternative embodiment of theoperational procedure 1300 of FIG. 14 including optional operation 1518that shows wherein the issue line is advanced in units of time. Forexample, the issue line in this embodiment can be advanced in units oftime, for example, in milliseconds. In this example, the time values foreach flow may also be stored in milliseconds, however they are reducedby weighted amounts using the equations described above. By using theequation above an implementer can add time to each flow, even if theflows have different weights, by changing the issue line. In thisexample embodiment the balancer 226 can maintain balance for all flowson one timeline and add time to all flows by changing one number. Thiscan reduce the CPU cost associated with executing balancer code. As oneof skill in the art can appreciate, the equation used above is exemplaryand other equations can be used to reduce a client's flow withoutdeparting from the spirit of the subject matter described herein.

Referring now to FIG. 16, it shows an alternative embodiment of theoperational procedure 1300 of FIG. 15 including optional operation 1620that shows dynamically updating the maximum positive time value based onaverage latency of IO jobs. For example, in an embodiment of the presentdisclosure instead of being configured by an administrator, thepredetermined maximum amount of time that a client can save up for lateruse in issuing IO jobs to the hardware device can be dynamicallyupdated. In one implementation, the initial predetermined maximum amountof time can be set to a large number and scaled back based on theaverage latency of IO job completion signals. For example, in theinstance that a client is bursting to the hardware device, e.g., sending10 seconds worth of data to the hardware device the balancer 226 can beconfigured to determine the average amount of time it took for each jobfrom the time it was sent from the balancer 226 until a competitionsignal is received from the hardware and compares that to the averageamount of time it took for jobs from other clients to completecalculated from the time the jobs were stored in the queue until thetime they were completed. If, for example, the different is 10 times asgreat then the predetermined maximum amount of time can be reduced. Inan alternative embodiment the average amount of time it took for eachjob for the busting client to be completed can be compared to theaverage amount of time it took for each job from a client that has anallocated amount of time but was not at the predetermined maximum. Ifthe average latency is a factor of, for example, 2 the predeterminedmaximum amount of time can be reduced.

The foregoing detailed description has set forth various embodiments ofthe systems and/or processes via examples and/or operational diagrams.Insofar as such block diagrams, and/or examples contain one or morefunctions and/or operations, it will be understood by those within theart that each function and/or operation within such block diagrams, orexamples can be implemented, individually and/or collectively, by a widerange of hardware, software, firmware, or virtually any combinationthereof.

While particular aspects of the present subject matter described hereinhave been shown and described, it will be apparent to those skilled inthe art that, based upon the teachings herein, changes and modificationsmay be made without departing from the subject matter described hereinand its broader aspects and, therefore, the appended claims are toencompass within their scope all such changes and modifications as arewithin the true spirit and scope of the subject matter described herein.

1. A method for balancing hardware usage, the method comprising:receiving an IO job associated with a client; determining that ahardware device has spent an estimated amount of time completing jobsassociated with the client that exceeds an amount of time that wasallocated to complete IO jobs from the client; and storing the IO job ina queue.
 2. The method of claim 1, further comprising: receiving an IOjob completion signal from the hardware device; determining thatestimated completion times for IO jobs pending in the hardware devicetotal to a completion time value that is lower than a predeterminedvalue; and sending the IO job to the hardware device.
 3. The method ofclaim 1, wherein the client is a virtual machine.
 4. The method of claim1, wherein the client is a terminal server session.
 5. The method ofclaim 1, further comprising: receiving an IO job associated with asecond client; determining that the second client is associated withinformation that identifies an amount of time that the hardware devicecan spend completing job requests from the second client; and sendingthe IO job request associated with the second client to the hardwaredevice.
 6. The method of claim 5, further comprising: determining thatthe amount of time that the hardware device can spend completing jobrequests from the second client exceeds a predetermined maximum amountof time; and reducing the amount of time that the hardware device canspend completing job requests from the second client to thepredetermined maximum amount of time.
 7. The method of claim 5, furthercomprising: reducing the amount of time that the hardware device canspend completing job requests from the second client based on a prioritylevel associated with the client.
 8. The method of claim 6, wherein thepredetermined maximum amount of time is dynamically updated based onaverage latency of IO jobs.
 9. A computer system comprising: circuitryfor storing a value indicative of an amount of time a hardware devicecan spend completing IO jobs from the client; circuitry for receiving IOjobs associated with the client; circuitry for estimating an amount oftime the hardware device will need to complete the IO jobs; circuitryfor revising the value based on the estimated amount of time required tocomplete the IO jobs; and circuitry for sending the IO jobs to thehardware device.
 10. The computer system of claim 9, further comprising:circuitry for determining that the amount of time the hardware devicecan spend completing IO jobs from the client is greater than a maximumamount of time a client can use the hardware device; and circuitry forreducing the amount of time the hardware device can spend completing IOjobs to the maximum amount of time.
 11. The computer system of claim 9,further comprising: circuitry for revising the value based a prioritylevel for the client.
 12. The computer system of claim 9, furthercomprising: circuitry for receiving additional IO jobs from the client;circuitry for determining that the client has overused the hardwaredevice based on the revised value; and circuitry for storing theadditional IO jobs in a queue.
 13. The computer system of claim 10,further comprising: circuitry for storing an IO job associated with asecond client in the queue; and circuitry for storing a second valueindicative of the amount of time the second client has overused thehardware device.
 14. The computer system of claim 13, furthercomprising: circuitry for determining that an estimated amount of timeassociated with jobs issued to the hardware device is lower than apredetermined value; circuitry for increasing the value and the secondvalue; circuitry for determining that the value is greater than thesecond value; circuitry for sending the additional IO jobs associatedwith the client to the hardware device; and circuitry for revising thevalue based on an additional estimated amount of time required tocomplete the additional IO jobs.
 15. A computer readable storage mediumincluding processor executable instructions for balancing IO requests,the computer readable storage medium comprising: instructions forstoring a plurality of negative time values, each negative time valueassociated with a client, each negative time value being indicative ofan estimated amount of time that a hardware device spent completing IOjobs associated with the client; instructions for storing a valueindicative of an issue line, the value indicative of the issue lineseparating positive time values from the negative values, the positivetime values associated with clients that are eligible to send IO jobs tothe hardware device; instructions for receiving a job completion signalfrom the hardware device; instructions for advancing the issue line anamount of time to make IO jobs associated with at least one negativetime value eligible for sending to the hardware device; and instructionsfor sending IO jobs that are eligible based on the advanced issue lineto the hardware device.
 16. The computer readable storage medium ofclaim 15, further comprising: instructions for setting a maximumpositive time value.
 17. The computer readable storage medium of claim15, further comprising: instructions for receiving IO jobs from a clientassociated with a positive time value; instructions for sending the IOjobs from the client associated with the positive time value to thehardware device; and instructions for adjusting an amount of time fromthe positive time value, the amount of the amount of time calculatedbased on an estimated amount of time required to complete the IO jobssent to the hardware device and a priority level for a client associatedwith the positive time value.
 18. The computer readable storage mediumof claim 15, further comprising: instructions for adjusting an amount oftime from the time value associated with the eligible IO jobs, theamount of time calculated based on an estimated amount of time requiredto complete the IO jobs sent to the hardware device and a priority levelfor a client associated with the newly positive time value.
 19. Thecomputer readable storage medium of claim 18, wherein the issue line isadvanced in units of time.
 20. The computer readable storage medium ofclaim 19, further comprising: instructions for dynamically updating themaximum positive time value based on average latency of IO jobs.